$(document).ready(function(e) {
	showtime();
	mainmenu();
	whyGW();
	tabbing();
	layout_add();
		
	
	// IE6 pngfix
	var Browser = {
	Version: function() {
		var version = 999; // we assume a sane browser
		if (navigator.appVersion.indexOf("MSIE") != -1)
			// bah, IE again, lets downgrade version number
			version = parseFloat(navigator.appVersion.split("MSIE")[1]);
			return version;
		}
	}
	if (Browser.Version() < 7) {
		DD_belatedPNG.fix('#logo,#index_p12 a,#index_p21 a,#index_p22 a,.login-box,#mainmenu9,#aboutus_menu,#left_menu, .back2top,.trans,#social a,h4 span,#clock span,.more,#contact-info div,div,img');
	}
});

var delta = 0 ;//= (new Date()).getTime() - 1301554066092;// how much is client faster than server
function showtime() {
	var today = new Date((new Date()).getTime() - delta);
	
	var hour = today.getHours();
	var minute = today.getMinutes();
	var second = today.getSeconds();
	if (hour <= 9)
		hour = "0" + hour;
	if (minute <= 9)
		minute = "0" + minute;
	if (second <= 9)
		second = "0" + second;
		      
	var utc = today.getTime() + (today.getTimezoneOffset() * 60000);
	var ldDate = new Date(utc + (3600000 * (1)));
	var nyDate = new Date(utc + (3600000 * (-4)));
	var tyDate = new Date(utc + (3600000 * (9)));
	var sxDate = new Date(utc + (3600000 * (2)));
	
	var ldhour = ldDate.getHours() < 9 ? ("0" + ldDate.getHours()) : ldDate.getHours();
	var nyhour = nyDate.getHours() < 9 ? ("0" + nyDate.getHours()) : nyDate.getHours();
	var tyhour = tyDate.getHours() < 9 ? ("0" + tyDate.getHours()) : tyDate.getHours();
	var sxhour = sxDate.getHours() < 9 ? ("0" + sxDate.getHours()) : sxDate.getHours();
	
	var strldtime = ldhour + ":" + minute + ":" + second + " ";
	var strnytime = nyhour + ":" + minute + ":" + second + " ";
	var strtytime = tyhour + ":" + minute + ":" + second + " ";
	var strhktime = hour + ":" + minute + ":" + second + " ";
	var strsxtime = sxhour + ":" + minute + ":" + second;
	
	$('#clock .ldtime').html(strldtime);
	$('#clock .nytime').html(strnytime);
	$('#clock .tytime').html(strtytime);
	$('#clock .hktime').html(strhktime);
	$('#clock .sxtime').html(strsxtime);
	setTimeout("showtime();", 500); 
}

function mainmenu()	{
	$('.submenu').hide();
	$('#mainmenu>li').hover(
		function(e) {
			$(this).children('.submenu').fadeIn('fast');
		},
		function(e) {
			$(this).children('.submenu').hide();
		}
	);
 	
 	
 	
 	
// 	/**
// 	* 菜单
// 	*/
// 	function mainmenuFunction() {
// 	var itemA="";
// 	$('mainmenu>li').hover(
// 	function(e) {
// 	//全部隐藏
// 	$(this).children('.submenu').hide();
// 	$("[id^='item_']").each(function(i){
// 	var thisId=$(this).attr("id");
// 	var className=$(this).attr("class");
// 	var onClass=thisId+"_on";
// 	if(onClass!=className)
// 	$(this).attr("class",thisId);
// 	});
// 	//当前选中
// 	itemA=$(this).children('a').attr("id");
// 	if(itemA)
// 	$("#"+itemA).attr("class",itemA+"_class");
// 	$(this).children('ul').fadeIn('fast');
// 	},
// 	function(e) {
// 	$("#nav_items ul").hide();
// 	if(itemA)
// 	$("#"+itemA).attr("class",itemA);
// 	headerMenuFrunction();
// 	}
// 	);
// 	} 
// 	
 	
 	
 	
}

function getZhUrl(){
	 var oldurl=location.href;
	 var URL = $('body').hasClass('front')?"/index-zh.html":"../zh"+oldurl.substring(oldurl.lastIndexOf("index.html"));
	 location.href=URL;
  // location.href = "../langAction?language=zh&oldurl=" + location.href;
}
function getTwUrl(){	
	 var oldurl=location.href;
	 var URL = $('body').hasClass('front')?"/index-tw.html":"../tw"+oldurl.substring(oldurl.lastIndexOf("index.html"));
	 location.href=URL;
  // location.href = "../langAction?language=tw&oldurl=" + location.href;
}
function getEnUrl(){
	 var oldurl=location.href;
 	 var URL = $('body').hasClass('front')?"/index-en.html":"../en"+oldurl.substring(oldurl.lastIndexOf("index.html"));
	 location.href=URL;
  // location.href = "../langAction?language=en&oldurl=" + location.href;
}

function tabbing()	{
	$('.tabbox .tabbing a').each(function(index, element) {
		if(!$(this).hasClass('on'))	{
			$(this).parents('.tabbox').find('#'+$(this).attr('rel')).hide();
		}
		$(this).mouseover(function(e) {
			if(!$(this).hasClass('on'))	{
				$(this).parents('.tabbox').find('#'+$(this).attr('rel')).show();
				$(this).addClass('on');
				
				//新增-略缩图显示-开始
				var ah = $(this).parents('.tabbox').find('#'+$(this).attr('rel')).find("a").first();
				var tr = $(this).parents('.tabbox').find('#'+$(this).attr('rel')).children("table").html();
				//判断：如果有tr标签，则取tr里的第一个a标签图片，否则图片为空
				if(tr != ''){
					$('#goldchannel-thumb img').attr('src', $(ah).attr('rel'));
				}else{
					$('#goldchannel-thumb img').attr('src', '');
				}
				$('#goldchannel-thumb').attr('href', $(ah).attr('href'));
				$('#goldchannel-thumb .mask').show();
				//新增-略缩图显示-结束
				
				oth = $(this).siblings('.on');
				$(oth).parents('.tabbox').find('#'+$(oth).attr('rel')).hide();
				$(oth).removeClass('on');
			}
		});
	})
}

function layout_add()	{
	//$('#wrap').wrap('<div id="bg-top" />');
	//$('#top-nav').wrapInner('<div class="top-nav-inner" />');
	/*
	$(".alt-row").each(function(i, e) {
		$(this).find('tr').filter(':even').addClass('row1');
		$(this).find('tr').filter(':odd').addClass('row2');
	});
	*/
}

function trim(str) { 
	return str.replace(/^\s+|\s+$/, ''); 
};

function calculator() {
	var eee = $('#calculator-result').text();
	$('#calculator-buy').click(function(e) {
		$(this).addClass('on');
		$('#calculator-sell').removeClass('on');
	});
	$('#calculator-sell').click(function(e) {
		$(this).addClass('on');
		$('#calculator-buy').removeClass('on');
	});
	$('#calculator-price1').focusout(function(e) {
		if($(this).val()!="") {$(this).addClass('on')}
		else	{$(this).removeClass('on');}
	});
	$('#calculator-price2').focusout(function(e) {
		if($(this).val()!="") {$(this).addClass('on')}
		else	{$(this).removeClass('on');}
	});
	
	$('#calculator-clear').click(function(e) {
		$('#calculator-result').text(eee);
		$('#calculator-price1').val('').removeClass('on');
		$('#calculator-price2').val('').removeClass('on');
	});
	
	$('#calculator-cal').click(function(e) {
		if(Number($('#calculator-price1').val())>0)	{
			p1 = $('#calculator-price1').val();
		}	else	{
			p1 = 0;
			$('#calculator-price1').val('0').addClass('on');
		}
		if(Number($('#calculator-price2').val())>0)	{
			p2 = $('#calculator-price2').val();
		}	else	{
			p2 = 0;
			$('#calculator-price2').val('0').addClass('on');
		}
		var result2;
		
		if($('#calculator-buy').hasClass('on'))	{
			result2 = (p2-p1)*100;
		}	else	{
			result2 = (p1-p2)*100;
		}
		result2 = isNaN(result2)?"--":result2.toFixed(2);
		
		$('#calculator-result').text(result2);
	});
}

function calculator2()	{
	var clientClass=$('#clientClass').val(); 	//會籍選擇
	var product=$('#productName2').val(); 	//產品種類
	var dealType=$('#dealType2').val();	//買賣方向
	
	var openprice=$('#openprice2').val(); //A 建倉價
	var closeprice=$('#closeprice2').val();//B 平倉價
	var contract=$('#contract').val();	//C 合約單數
	var holddays=$('#holddays2').val();	//D 持倉日數
	
	var guarantee="";	//保證金
	var interest="";	//支付利息
	var result="";		//淨盈虧
	
	if(product=='all'){	alert($('#productName2').attr('rel'));return;}
	if(dealType=="all"){alert($('#dealType2').attr('rel'));return;}
	if(openprice==""){ 	alert($('#openprice2').attr('rel'));return;}
	if(closeprice==""){ alert($('#closeprice2').attr('rel'));return;}
	if(contract==""){ 	alert($('#contract').attr('rel'));return;}
	if(holddays=="" || holddays<0 ){	alert($('#holddays2').attr('rel'));return;}
	
	
			//倫敦金
		if(clientClass=="0"){	
			if(product=="gold"){
				if(dealType=="buy"){
					guarantee  =  contract * 1000;
					interest   =  openprice * contract * 100 * 0.0125 * (holddays/360);
					result     =  (closeprice-openprice) * contract * 100 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}else if(dealType=="sell"){
					guarantee=contract*1000;
					interest=openprice*contract*100*0.0075*(holddays/360);
					result=(openprice-closeprice)*contract*100-interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}
			}
			//倫敦銀
			else if(product=="silver"){
				if(dealType=="buy"){
					guarantee  =  contract * 650;
					interest   =  openprice * contract * 5000 * 0.0125 * (holddays/360);
					result     =  (closeprice - openprice) * contract * 5000 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}else if(dealType=="sell"){
					guarantee  =  contract * 650;
					interest   =  openprice * contract * 5000 * 0.0075 * (holddays/360);
					result     =  (openprice-closeprice) * contract * 5000 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}		
			}
		}else if(clientClass=="1"){
				if(product=="gold"){
					if(dealType=="buy"){
						guarantee  =  contract * 1000;
						interest   =  openprice * contract * 100 * 0.012 * (holddays/360);
						result     =  (closeprice-openprice) * contract * 100 - interest;
						if(result < -guarantee*0.8) result= (-guarantee*0.8);
					}
					
					else if(dealType=="sell"){
						guarantee=contract*1000;
						interest=openprice*contract*100*0.007*(holddays/360);
						result=(openprice-closeprice)*contract*100-interest;
						if(result < -guarantee*0.8) result= (-guarantee*0.8);
					}
				}
				//倫敦銀
				else if(product=="silver"){
					if(dealType=="buy"){
						guarantee  =  contract * 650;
						interest   =  openprice * contract * 5000 * 0.012 * (holddays/360);
						result     =  (closeprice - openprice) * contract * 5000 - interest;
						if(result < -guarantee*0.8) result= (-guarantee*0.8);
					}
					else if(dealType=="sell"){
						guarantee  =  contract * 650;
						interest   =  openprice * contract * 5000 * 0.007 * (holddays/360);
						result     =  (openprice-closeprice) * contract * 5000 - interest;
						if(result < -guarantee*0.8) result= (-guarantee*0.8);
					}		
				}
		}else if(clientClass=="2"){
			if(product=="gold"){
				if(dealType=="buy"){
					guarantee  =  contract * 1000;
					interest   =  openprice * contract * 100 * 0.01 * (holddays/360);
					result     =  (closeprice-openprice) * contract * 100 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}
				
				else if(dealType=="sell"){
					guarantee=contract*1000;
					interest=openprice*contract*100*0.005*(holddays/360);
					result=(openprice-closeprice)*contract*100-interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}
			}
			//倫敦銀
			else if(product=="silver"){
				if(dealType=="buy"){
					guarantee  =  contract * 650;
					interest   =  openprice * contract * 5000 * 0.01 * (holddays/360);
					result     =  (closeprice - openprice) * contract * 5000 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}
				else if(dealType=="sell"){
					guarantee  =  contract * 650;
					interest   =  openprice * contract * 5000 * 0.005 * (holddays/360);
					result     =  (openprice-closeprice) * contract * 5000 - interest;
					if(result < -guarantee*0.8) result= (-guarantee*0.8);
				}		
			}
		} 
	$('#guarantee').val(guarantee.toFixed(2));
	$('#interest').val(interest.toFixed(2));
	$('#result').val(result.toFixed(2));
}

function whyGW()	{
	if($("#whyGW").attr('rel'))	{
		var defaultSlide = $("#whyGW").attr('rel')-1;
		$("#whyGW dt").eq(defaultSlide).addClass('on');
		$("#whyGW dd").eq(defaultSlide).addClass('on').show();
	}
	var tout;
	var obj;
	var thisClass;
	$('#whyGW dt').mouseover(function(e) {
		if(tout)
			clearTimeout(tout);
		obj=$(this);
		if(!$(this).hasClass('on'))	{
			$('#whyGW dd.on').slideUp();
			$('#whyGW .on').removeClass('on');
			thisClass = $(this).attr('class');
			thisClass = thisClass.indexOf(" ")>0?thisClass.substr(0, thisClass.indexOf(" ")):thisClass;
			//$('#whyGW dd.'+thisClass).addClass('on').slideDown();
			//$(this).addClass('on');
		}
		tout=setTimeout(function(){			
				$('#whyGW dd.'+thisClass).addClass('on').slideDown();
				obj.addClass('on');			
		},600);
		
	});
}

function awards_slider()	{
	var frameWidth = $('#awards-slider').width();
	var rollWidth = 0;
	var timeFactor = 500;
	
	$('#awards-slider').children('ul').children().each(function(i, e) {
		rollWidth+= $(this).width();

	});
	$('#awards-slider ul').width(rollWidth);
	var margin = rollWidth - frameWidth;
	if(margin>0)	{
		$('#awards .arrowNext').mouseover(function(e) {
			var $obj = $('#awards-slider ul');
			var aniTime = Math.ceil((margin+parseInt($obj.css('margin-left')))/100)*timeFactor;
			
			$obj.animate({
				marginLeft: -margin
			}, aniTime, function() {
			// Animation complete.
			});
		});
		
		$('#awards .arrowNext').mouseout(function(e) {
			var $obj = $('#awards-slider ul');
			$obj.stop();
		});
		
		$('#awards .arrowPrev').mouseover(function(e) {
			var $obj = $('#awards-slider ul');
			var aniTime = Math.ceil(-parseInt($obj.css('margin-left'))/100)*timeFactor;
	
			$obj.animate({
				marginLeft: 0
			}, aniTime, function() {
			// Animation complete.
			});
		});
		
		$('#awards .arrowPrev').mouseout(function(e) {
			var $obj = $('#awards-slider ul');
			$obj.stop();
		});
	}
}

var tout;
function rainbow()	{
	$('#rainbow').append('<div class="clear"/>');
	var flist = $('#rainbow>a');
	$('#rainbow>a').hover(
		function(e) {
			clearTimeout(tout);
			$('#rainbow>a').removeClass('expand');
			$(this).addClass('expand');
		},
		function(e)	{
			var nextX = $(this).index()%flist.length+1;
			rainbow_rotate(nextX);
		}
	);
	rainbow_rotate(1);
}
function rainbow_rotate(x)	{
	var flist = $('#rainbow>a');
	$(flist).removeClass('expand');
	$(flist.get(x-1)).addClass('expand');
	x = x%flist.length+1;
	tout = setTimeout("rainbow_rotate('"+x+"');", 5000); 
}
//var _$LoadTime = (new Date()).getTime();

function goldchannel()	{
	$('.goldchannel-table tr').mouseover(function(e) {
		var ah = $(this).find('a');
		$('#goldchannel-thumb').attr('href', $(ah).attr('href'));
		$('#goldchannel-thumb img').attr('src', $(ah).attr('rel'));
		if($(this).index()>0)	{
			$('#goldchannel-thumb .mask').hide();
		}	else	{
			$('#goldchannel-thumb .mask').show();
		}
	});
	$('.goldchannel-table tr').click(function(e) {
		var ah = $(this).find('a');
		location.href = $(ah).attr('href');
	})
}

function map()	{
	$('.map-enlarge a').hide();
	var tar = $('.map-control .on').attr('rel');
	$('#contact-map').addClass(tar);
	$('.map-enlarge .'+tar).show();
	
	$('.map-control li').click(function(e) {
		if(!$(this).hasClass('on'))	{
			var tar2 = $(this).attr('rel');
			$(this).siblings().removeClass('on');
			$(this).addClass('on');
			$('#contact-map').attr('class', tar2);
			$('.map-enlarge a').hide();
			$('.map-enlarge .'+tar2).show();
		}
	});
}

function showhide()	{
	var tar = $('.showhide').attr('rel');
	$('.showhide').children().hide();
}

function showhideDIV(x)	{
	$('.showhide').children().hide();
	$('.showhide').children('#'+x).show();
}

function dlClose()	{
	$(".dlClose a").wrapInner('<div class="right"><div class="left"></div></div>');
	$(".dlClose .collapse").click(function(e) {
		var rel = $(this).parent('.dlClose').attr('rel');
		$('#'+rel + ' dd').slideUp();
	});
	$(".dlClose .expand").click(function(e) {
		var rel = $(this).parent('.dlClose').attr('rel');
		$('#'+rel + ' dd').slideDown();
	});
	
	$(".ddShowHide dt").click(function(e) {
		$(this).next('dd').slideToggle();
	});
	$(".ddShowHide").each(function(index, element) {
		$(this).children('dd').hide();
	});
}


///////////////////////////////////////////////分页公共代码/////////////////////////////////////////////////////
/**
 * p代表当前页码
 * pageJian 代表向前推5页和向后推五页
 * **/
function genPaging(x)	{
	var url = self.location.toString();
	var filename = returnDocument(url);
	
	var fileext = url.substr(url.lastIndexOf('.'));
	var p = 1;
	if(filename.lastIndexOf('-')>-1)	{
		p = parseInt(filename.substr(filename.lastIndexOf('-')+1));
		filename = filename.substr(0,filename.lastIndexOf('-'));
	}
	
	var bar = 9;
	var pageJian = 5;
	var thisLink;
	
	var obj;
	if(p>1)	{
		var y = p-1;
		var firstLink="";
		if(y==1)
		   firstLink = filename+fileext;
		else
		   firstLink = filename+'-'+y+fileext;
		//暂时注释上一页显示
	//	$('.page_nub').append('<a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+firstLink+'" ><</a> ');
	}
	
	var start = (p-bar)>0?p-pageJian:1;
	
	var end = 0;
	if(p<pageJian){
		    end = (p+bar)>x?x:p+bar;
	}else{
	        end = (p+bar)>x?x:p+pageJian;
}
	
	for(var i=start; i<=end; i++)	{
		thisLink = i==1?filename+fileext:filename+'-'+i+fileext;
		if(i==p)	{
			$('.page_nub').append('<a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+thisLink+'" class="page_on">'+i+'</a>');
		}	else	{
			$('.page_nub').append('<a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+thisLink+'" >'+i+'</a>');
		}
		if(i!=end)	{
			$('.page_nub').append(' | ');
		}
	}
	
	if(p<x)	{
		var y = p+1;
		var lastLink = filename+'-'+y+fileext;
		//暂时注释下一页显示
		//$('.page_nub').append(' <a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+lastLink+'" >></a>');
	}
	
}

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}


function setNavigation()	{
	if($('#navigation').length>0)	{
		var path = '<a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+($('body').hasClass('front')?"/":"../")+mainUrl+'">'+mainText+'</a> > ';
		var title = $('#navigation').text();
		var navhtml = $('#navigation').html();
		
		if(title.indexOf('>')>0)	{
			var xx = title.substr(title.lastIndexOf('>')+1);
			navhtml = navhtml.replace(xx, '<span>'+xx+'</span>');
			title = title.substr(0, title.indexOf('>')-1);
		}	else	{
			navhtml = '<span>'+navhtml+'</span>'
		}
		var duck = $('#mainmenu').find('a');
		
		$.map(duck, function(val, i) {
			
		})
		for(i=0; i<duck.length; i++)	{
			val = duck[i];
			if($(val).text())	{
				if($(val).text().indexOf(title)==0)	{
					
					var x = $(val).closest('.mainmenu').children('a');
					var url = $(x).attr('href');
					var txt = $(x).text();
					path += '<a href="'+url+'">'+txt+'</a> > ';
					
					var par = $(val).parent().parent().parent();
					if(par.is('li'))	{
						var url2 = par.children('a').attr('href');
						var txt2 = par.children('a').text();
						path += '<a href="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+url2+'">'+txt2+'</a> > ';
					}
					break;
				}
			}
		}
		
		
		
		$('#navigation').html(path + navhtml);
		
	}
	
}


function returnDocument(file_name) {
	//var file_name = document.location.href;
	var end = (file_name.lastIndexOf(".") == -1) ? file_name.length : file_name.lastIndexOf(".");
	return file_name.substring(file_name.lastIndexOf("index.html")+1, end);
}
//电邮地址验证
function checkEmail(email){
   // var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 有问题:如:chen-33@163.com
	  var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

    if(!reg.test(email)){
       return false;
    }
       return true;

}

function playerFlv(swf_width,swf_height,files,texts,swfUrl){
	
	
	  /**
  vcastr_file 方法2传递影片flv文件地址参数，多个使用|分开 空 
	vcastr_title 影片标题参数，多个使用|分开，与方法2配合使用 空 
	vcastr_xml 方法3 传递影片flv文件地址参数，样板参考 http://www.ruochi.com/product/vcastr2/vcastr.xml  vcastr.xml 
	IsAutoPlay 影片自动播放参数：0表示不自动播放，1表示自动播放 0 
	IsContinue 影片连续播放参数：0表示不连续播放，1表示连续循环播 1 
	IsRandom 影片随机播放参数：0表示不随机播放，1表示随机播放 0 
	DefaultVolume 默认音量参数 ：0-100 的数值，设置影片开始默认音量大小 100 
	BarPosition 控制栏位置参数 ：0表示在影片上浮动显示，1表示在影片下方显示 0 
	IsShowBar 控制栏显示参数 ：0表示不显示；1表示一直显示；2表示鼠标悬停时显示；3表示开始不显示，鼠标悬停后显示 2 
	BarColor 播放控制栏颜色，颜色都以0x开始16进制数字表示 0x000033 
	BarTransparent 播放控制栏透明度 60 
	GlowColor 按键图标颜色，颜色都以0x开始16进制数字表示 0x66ff00 
	IconColor 鼠标悬停时光晕颜色，颜色都以0x开始16进制数字表示 0xFFFFFF 
	TextColor 播放器文字颜色，颜色都以0x开始16进制数字表示 0xFFFFFF 
	LogoText 可以添加自己网站名称等信息(英文) 空 
	LogoUrl 可以从外部读取logo图片，注意自己调整logo大小，支持图片格式和swf格式 空 
	EndSwf 影片播放结束后,从外部读取swf文件，可以添加相关影片信息，影片分享等信息，需自己制作 空 
	BeginSwf 影片开始播放之前,从外部读取swf文件，可以添加广告，或者网站信息，需自己制作 空 
	IsShowTime 是否显示时间 : 0表示不显示时间，1表示显示时间 1 
	BufferTime 影片缓冲时间，单位（秒） 2 
   **/

		var config='0:自动播放|1:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|80:主体透明度|0xffff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:标题|:logo地址|:结束swf地址';
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
		document.write('<param name="movie" value="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+ swfUrl +'"><param name="quality" value="high">');
		document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
		document.write('<param name="FlashVars" value="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'">');
		document.write('<embed src="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+ swfUrl +'" wmode="opaque" FlashVars="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>'); 
	
}
//点击播放视频
function playerFlvis(elm,swf_width,swf_height,files,texts,swfUrl){
	if (!document.getElementById(elm)) return;
	var str = '';
		var config='1:自动播放|1:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|80:主体透明度|0xffff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:标题|:logo地址|:结束swf地址';
		str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">';
		str += '<param name="movie" value="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+ swfUrl +'"><param name="quality" value="high">';
		str += '<param name="menu" value="false"><param name=wmode value="opaque">';
		str += '<param name="FlashVars" value="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'">';
		str += '<embed src="../金道环球投资GWFX是香港SFC、英国FCA、新西兰FSP认证的外汇交易平台,专注黄金、白银、外汇交易,拥有MT4、GWFX双软件交易平台。_files/'+ swfUrl +'" wmode="opaque" FlashVars="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		str += '</object>'; 
		document.getElementById(elm).innerHTML = str;	
}


//auto redirect
var ss = 5;
function autoGo(URL) {
	if (ss == -1)
		return;
	
	try {
		document.getElementById("sstep").innerHTML =  ss;
	} catch (e) {
		return;
	}
	ss--;
	if (ss < 0)
		ss = 0;
	if (ss == 0) {
		try {
			window.doNext();
		} catch (e) {
			location.href = URL;
		}
		ss = -1;
	}
}
//解析主机
function getHostByLP(){
	var h=window.location.host;
	if(h.indexOf("gwfx")>=0){
		h="http://oa.gwfx.com/";
	}
	else if(h.indexOf("218.213.241.114")>=0){
		h="http://218.213.241.114:9001/";
	}
	else{
		h="";
	}
	return h;
}

